using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Package;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Designer.Interfaces;
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Xml;
using System.Diagnostics;

using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider;
using IServiceProvider = System.IServiceProvider;

namespace MH.WsdlWorks
{
    [CLSCompliant(false), ComVisible(true)]
    public class SimpleFileNodeProperties : SimpleNodeProperties
    {
        #region properties
        [SRCategoryAttribute(SR.Advanced)]
        [Microsoft.VisualStudio.Package.LocDisplayName(SR.BuildAction)]
        [SRDescriptionAttribute(SR.BuildActionDescription)]
        public virtual Microsoft.VisualStudio.Package.BuildAction BuildAction
        {
            get
            {
                Debug.Assert(this.Node != null, "The associated hierarchy node has not been initialized");
                string value = this.Node.ItemNode.ItemName;
                if (value == null || value.Length == 0)
                    return Microsoft.VisualStudio.Package.BuildAction.None;
                return (Microsoft.VisualStudio.Package.BuildAction)Enum.Parse(typeof(Microsoft.VisualStudio.Package.BuildAction), value);
            }
            set
            {
                Debug.Assert(this.Node != null, "The associated hierarchy node has not been initialized");

                this.Node.ItemNode.ItemName = value.ToString();
            }
        }

        [SRCategoryAttribute(SR.Misc)]
        [Microsoft.VisualStudio.Package.LocDisplayName(SR.FileName)]
        [SRDescriptionAttribute(SR.FileNameDescription)]
        public string FileName
        {
            get
            {
                Debug.Assert(this.Node != null, "The associated hierarchy node has not been initialized");

                return this.Node.Caption;
            }
            set
            {
                Debug.Assert(this.Node != null, "The associated hierarchy node has not been initialized");

                this.Node.SetEditLabel(value);
            }
        }

        [SRCategoryAttribute(SR.Misc)]
        [Microsoft.VisualStudio.Package.LocDisplayName(SR.FullPath)]
        [SRDescriptionAttribute(SR.FullPathDescription)]
        public string FullPath
        {
            get
            {
                Debug.Assert(this.Node != null, "The associated hierarchy node has not been initialized");

                return this.Node.Url;
            }
        }

        #region non-browsable properties - used for automation only
        [Browsable(false)]
        public string Extension
        {
            get
            {
                Debug.Assert(this.Node != null, "The associated hierarchy node has not been initialized");

                return Path.GetExtension(this.Node.Caption);
            }
        }
        #endregion

        #endregion

        #region ctors
        public SimpleFileNodeProperties()
        {
        }

        public SimpleFileNodeProperties(SimpleHierarchyNode node)
            : base(node)
        {
        }
        #endregion

        #region overridden methods
        public override string GetClassName()
        {
            return SR.GetString("FileProperties");
        }
        #endregion

    }
}
